package com.voxel.sense.infomsg.module.vedio;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;

import com.example.com.common.app.BaseActivity;
import com.voxel.sense.infomsg.R;
import com.voxel.sense.infomsg.module.firm.details.video.FirmVideoFrag;

import cn.jzvd.Jzvd;
import cyy.example.com.facotry.constants.IntentConstants;


public class FullScreenJPlayerActivity extends BaseActivity {

    private String mFile;
//    @BindView(R.id.jzv)
//    MyJZVideoPlayerPlay jzv;

    public static void show(Context context, String file) {
        if (TextUtils.isEmpty(file)) {
            return;
        }
        Intent intent = new Intent(context, FullScreenJPlayerActivity.class);
        intent.putExtra(IntentConstants.STRING_TYPE, file);
        context.startActivity(intent);

    }


    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_full_screen_jplayer;
    }

    @Override
    protected boolean initArgs(Bundle bundle) {
        mFile = getIntent().getStringExtra(IntentConstants.STRING_TYPE);
        return super.initArgs(bundle);
    }

    @Override
    protected void initData() {
        super.initData();
        //切换播放器 内核
//        Jzvd.setMediaInterface(new JZMediaIjkplayer());
//        Jzvd.startFullscreen(this, Jzvd.class, mFile, "");
//        jzv.setUp("http://hls.open.ys7.com/openlive/9a9a4978e0724836a52441a8850b71d7.m3u8"
//                , "饺子快长大", JzvdStd.SCREEN_WINDOW_NORMAL);

        Bundle bundle = new Bundle();
        bundle.putString(IntentConstants.STRING_TYPE, "2184");
        Fragment.instantiate(this, FirmVideoFrag.class.getName(), bundle);
        getSupportFragmentManager().beginTransaction().replace(R.id.fgm,Fragment.instantiate(this, FirmVideoFrag.class.getName(), bundle)).commit();
    }

    @Override
    public void onBackPressed() {
        if (Jzvd.backPress()) {
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {
        super.onPause();
        Jzvd.resetAllVideos();
    }
}
